< previous page page_366 next page >

Page 366
The AllCustomers collection class has the following methods:
Public Function Add(AccountNumber, CustomerID, FirstName _ As String,  MiddleInitial As String, LastName As String, _ Optional sKey As String)  As Customer
Public Sub buildReport(argFileName As String, _
Optional argRichTextBox As RichTextBox)
Public Sub getFirstObject()
Public Sub getLastObject()
Public Sub getNextObject()
Public Sub getPreviousObject()
Public Sub getCDRReportHeading(argRichTextBox _
As RichTextBox, ByRef argCols)
Public Sub initializeObjects(ParamArray argPropertyStates())
Public Sub Remove(vntIndexKey As Variant)
Public Sub saveAllCustomers()
Most of these methods' names clearly explain the purpose of the underlying method. The initializeObjects method is a facade to the Add method so that it can be used in a loop in the RichTextReporting mechanism when creating each object to be added to the collection from a comma-delimited file. Why the facade? Because you don't want RichTextReporting to have to know each property in the class. It should know only each column in the comma-delimited file. This helps with encapsulation concerns. The saveAllCustomers method works the same as initializeObjects, but in reverse, saving each object's data (or state) to the file. The RichTextFile handles the details of saving the information. Again, encapsulation of properties is achieved because the AllCustomers collection is adding the information to the contents of the Rich Text Box via the RichTextFile's Contents property.
The AllCustomers class also has the following properties:
Public Property Get Count() As Long
Public Property Get CurrObject() As Customer
Public Property Get Item(vntIndexKey As Variant) As Customer

 
< previous page page_366 next page >

If you like this book, buy it!